//
//  readViewController.m
//  Moment
//
//  Created by dllo on 15/12/22.
//  Copyright © 2015年 谭泽源. All rights reserved.
//

#import "readViewController.h"
#import "GetData.h"
#import "Read.h"
#import <UIImageView+WebCache.h>
#import "PZRClickViewController.h"
//二种cell
#import "PZRReadShowTableViewCell.h"
#import "PZRDetailTableViewCell.h"


@interface readViewController ()<UIScrollViewDelegate,UITableViewDataSource,UITableViewDelegate,ClickDelegate>
@property (nonatomic,strong) UITableView *mainTableView;
@property (nonatomic,strong) NSMutableArray *allArray;
@end

@implementation readViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"阅读";
    self.mainTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) style:UITableViewStylePlain];
    self.mainTableView.delegate = self;
    self.mainTableView.dataSource = self;
    [self.mainTableView registerClass:[PZRReadShowTableViewCell class] forCellReuseIdentifier:@"mainTableView1"];
    [self.mainTableView registerClass:[PZRDetailTableViewCell class] forCellReuseIdentifier:@"mainTableView2"];
    [self.view addSubview:_mainTableView];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *chongyong1  = @"mainTableView1";
    static NSString *chongyong2  = @"mainTableView2";
    if (indexPath.row == 0)
    {
        PZRReadShowTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:chongyong1];
        return cell;
    }
    else if (indexPath.row == 1)
    {
        PZRDetailTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:chongyong2];
        cell.ClickDelegate = self;
        return cell;
    }
    return nil;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(indexPath.row == 0)
    {
        return SCREEN_HEIGHT/3;
    }
    else if (indexPath.row == 1)
    {
        return SCREEN_HEIGHT/3*2;
    }
    return 0;
}
-(void)pushToClick:(NSString *)type
{
   // NSLog(@"tui");
    PZRClickViewController *clickVC = [[PZRClickViewController alloc]init];
    clickVC.type = type;
    [self.navigationController pushViewController:clickVC animated:YES];
    
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}
@end
